Omplus.models.Language = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"Language",
    controller : "languageController",
    value : {
        code : {
            omplusType:"String",
            nullable:false
        },
        name : {
            omplusType:"String",
            nullable:false
        }
    }
});

Omplus.models.Privilege = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"Privilege",
    controller : "languageController",
    value : {
        id : {
            omplusType:"Number"
        },
        name : {
            omplusType:"String"
        }
    }
});

Omplus.models.Asset = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"Asset",
    controller : "languageController",
    value : {
        name : {
            omplusType:"String",
            nullable:false
        },
        localValue : {
            omplusType:"String",
            nullable:false
        }
    }
});

Omplus.base.define(Omplus.models.Model, {
    omplusName:"Assets",
    controller : "languageController",
    value:{
        "list":{
            omplusType:"Array",
            nullable:false,
            omplusProto: "Asset",
            getOmplusName : function(newValue){
                return this.omplusName + "." + newValue.name;
            }
        }
    }
});

Omplus.models.PerPage = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"PerPage",
    controller : "languageController",
    value : {
        number : {
            omplusType:"Number",
            nullable:false
        }
    }
});

Omplus.base.define(Omplus.models.SingleChooser, {
    omplusName:"Languages",
    controller : "languageController",
    omplusProto:"Language"
});

Omplus.base.define(Omplus.models.MultiDifferentChooser, {
    omplusName:"Privileges",
    controller : "languageController",
    omplusProto:"Privilege",
    currentModels:[
        "forUsers",
        "forEditUsers"
    ]
});

Omplus.models.Kontrolor = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"Kontrolor",
    controller : "languageController",
    value : {
        id : {
            omplusType:"Number"
        },
        username : {
            omplusType:"String"
        }
    }
});

Omplus.models.Verifikacija = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"Verifikacija",
    controller : "languageController",
    value : {
        number : {
            omplusType:"Number"
        },
        text : {
            omplusType:"String"
        }
    }
});

Omplus.models.Opstina = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"Opstina",
    controller : "languageController",
    value : {
        sifra : {
            omplusType:"Number"
        }
    }
});

Omplus.base.define(Omplus.models.MultiDifferentChooser, {
    omplusName:"Kontrolori",
    controller : "languageController",
    omplusProto:"Kontrolor",
    currentModels:[
        "forAnketari"
    ]
});

Omplus.base.define(Omplus.models.MultiDifferentChooser, {
    omplusName:"Verifikacije",
    controller : "languageController",
    omplusProto:"Verifikacija",
    currentModels:[
        "forForms",
        "forReturnedForms"
    ]
});

Omplus.base.define(Omplus.models.MultiDifferentChooser, {
    omplusName:"PerPages",
    controller : "languageController",
    omplusProto:"PerPage",
    currentModels:[
        "forAnketari",
        "forForms",
        "forUsers",
        "forReturnedForms",
        "forKontrola"
    ]
});

Omplus.base.define(Omplus.models.Model, {
    omplusName:"Localization",
    controller : "languageController",
    value:{
        languages : "Languages",
        assets : "Assets",
        pages : "PerPages",
        privileges: "Privileges",
        kontrolori: "Kontrolori",
        verifikacije: "Verifikacije",
        opstine: {
        	omplusType : "Array",
        	omplusProto : "Opstina"
        }
    },
    actions:[
        {
            omplusType:"Get",
            omplusName:"get",
            proxy:{
                omplusType:"AjaxProxy"
            },
            responseModel:"Localization",
            callback:function(){
            	console.log(Omplus.globals.getObject("Localization"));
            }
        },
        {
            omplusType:"Get",
            omplusName:"set",
            proxy:{
                omplusType:"AjaxProxy"
            },
            requestModel: "Languages.current",
            responseModel:"Localization"
        }
    ]
});

Omplus.base.define(Omplus.controllers.Controller, {

    omplusName:"languageController"

});